Software-defined networking (SDN) is a new network architecture, a technology OpenFlow included in the SDN implements flexible control over network traffic by separating a control plane of a network device from a forwarding plane of the network device such that implementation of load balancing becomes much easier. An implementation principle of load balancing is that a controller on the control plane allocates, based on network traffic, different forwarding paths to different data flows and a switch on the forwarding plane processes the data flows according to the forwarding paths received from the controller in order to implement load balancing.
In some approaches, a controller allocates a forwarding path according to a flow rate on a switch. A most frequently used method for collecting statistics about the flow rate is that the controller periodically sends, to the switch, a request message used to query a quantity of flow hits on any path (that is, an output port of the switch), and then obtains a flow rate of the path by calculation according to a result difference between two adjacent queries and a time difference between the two adjacent queries. However, the flow rate obtained by calculation using the statistics collecting method is not a real-time flow rate. As a result, the forwarding path allocated by the controller is inaccurate, and load balancing cannot be implemented well.